<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| This file is where you may define all of the routes that are handled
| by your application. Just tell Laravel the URIs it should respond
| to using a Closure or controller method. Build something great!
|
*/

Route::get('/', function () {
	return view('welcome');
});

//后台


Route::get('admin/login','admin\LoginController@index');
Route::post('admin/login','admin\LoginController@dologin');

Route::group(['prefix'=>'admin','middleware' => 'checkUser'],function(){
	Route::get('/logout','admin\LoginController@logout');
	Route::get('/','admin\IndexController@index');

	//管理员管理
    Route::resource('/tors','admin\TorsController');
	//商品管理
	Route::resource('/goods','admin\GoodController');
	// Route::post('/goods','admin\GoodController@Upload');
	//商品分类
	Route::resource('/cate','admin\CateController');
	//添加子类
	Route::get('/cateSon/{id}','admin\CateController@createSon');
	Route::post('/cateSon/','admin\CateController@storeSon');
});

//前台
Route::get('/home','home\IndexController@index');
Route::get('/home/gologin','home\LoginController@gologin');
Route::post('/home/dologin','home\LoginController@dologin');
Route::get('/home/register','home\LoginController@goregister');

Route::post('/home/doregister','home\LoginController@doregister');
Route::group(['prefix'=>'home','middleware' => 'checkhomeUser'],function(){
	Route::get('/loginhomeout','home\LoginController@loginhomeout');
	
 });

//带搜索分页的模板继承
Route::resource('/user','admin\UserController');

// 模板继承
// Route::get('/admin',function(){
// 	return view('admin.index');
// });